#!/bin/bash
dir="../Run/"
num=50
# 初始循环
numbers=(80)

for i in {0..3}
do
    for((j=${num};j<=61;j++))
        do  
            seeds=$(($RANDOM % 1000000))
            mdcrd='"'${dir}${numbers[$i]}'/md-'${j}'"'
            cellgene='"''../Run/genemat_'${numbers[$i]}'.txt"'
            
            str_seeds='s|^seed=.*|seed='$seeds'|'
            str_mdcrd='s|^mdcrd=.*|mdcrd='$mdcrd'|'
            str_cellgene='s|^cellgene=.*|cellgene='$cellgene'|'
        
            sed -i $str_seeds '../Run/md.in';
            sed -i $str_mdcrd '../Run/md.in';
            sed -i $str_cellgene '../Run/md.in';
            
            startTime=`date +"%Y-%m-%d %H:%M:%S"`
            ./bct.exe ../Run/md.in
            endTime=`date +"%Y-%m-%d %H:%M:%S"`
            st=`date -d  "$startTime" +%s`
            et=`date -d  "$endTime" +%s`
            sumTime=$(($et-$st))
            echo "Total time is : $sumTime second."
    done
done
